{% extends 'html模板/案件-base.html' %}
{% load staticfiles %}
{% block css %}
    <style>
        .zt1 a {
            color: #e35059;
        }

        a.btn {
            color: #fff;
        }
    </style>
    <link rel="stylesheet" href="/static/sweetalert/sweetalert.css">
    <script src="/static/sweetalert/sweetalert.js"></script>
{% endblock %}

{% block mianbaoxiedaohang %}
    案件详细信息列表
{% endblock %}

{% block main %}
    <div class="row-fluid">
        <div class="span12">
            <div class="widget-box">
                <div class="widget-title"><span class="icon"> <i class="icon-th"></i> </span>
                    <h5>详细案件列表</h5>
                </div>
                <div class="widget-content nopadding">
                    <style>
                        .table > tr > th, .table > tbody > tr > td {
                            text-align: center;
                        }
                    </style>
                    <table class="table table-bordered table-striped">
                        <thead>
                        <tr>
                            <th> 立案时间</th>
                            <th> 执法单位</th>
                            <th> 当事人</th>
                            <th> 案由</th>
                            <th> 案件类型</th>
                            <th> 涉案金额</th>
                            <th> 处罚金额</th>
                            <th> 案件状态</th>
                            <th> 操作</th>
                        </tr>
                        </thead>
                        <tbody>
                        {% for foo in list %}
                            <tr class="zt{{ foo.aj_zhuangtai }}">
                                <td>
                                    <div class=""><a href="/jie/{{ foo.id }}/">{{ foo.aj_time1 }}</a></div>
                                </td>
                                <td>
                                    <div class=""><a href="/jie/{{ foo.id }}/">{{ foo.shi }} {{ foo.xian }}</a></div>
                                </td>
                                <td>
                                    <div class=""><a href="/jie/{{ foo.id }}/">
                                        {{ foo.aj_dangshiren|default:"" }}{{ foo.aj_faren|default:"" }}</a></div>
                                </td>
                                <td>
                                    <div class=""><a href="/jie/{{ foo.id }}/">{{ foo.aj_anyou }}</a></div>
                                </td>
                                <td>
                                    <div class=""><a href="/jie/{{ foo.id }}/">{{ foo.get_aj_zhonglei_display }}</a>
                                    </div>
                                </td>
                                <td>
                                    <div class=""><a href="/jie/{{ foo.id }}/">{{ foo.aj_sheanjine|default:0 }}</a>
                                    </div>
                                </td>
                                <td>
                                    <div class=""><a href="/jie/{{ foo.id }}/">{{ foo.aj_chufajine|default:0 }}</a>
                                    </div>
                                </td>
                                <td>
                                    <div class=""><a href="/jie/{{ foo.id }}/">{{ foo.get_aj_zhuangtai_display }}</a>
                                    </div>
                                </td>
                                <td>
                                    <a class="btn btn-danger btn-sm del" pid="{{ foo.id }}" role="button">删除</a>
                                </td>
                            </tr>
                        {% endfor %}
                        </tbody>
                    </table>
                    <ul class="pagination pagination-sm pull-right">
                        {{ page_obj.page_str|safe }}
                    </ul>
                </div>
            </div>
        </div>
    </div>
{% endblock %}

{% block js %}
    <script>
        $('.ajlb').addClass('active')
        $('.pagination ').append('<li><a href="/download/ry/"><span class="icon-download-alt"></span></a></li>')
        $(".del").click(function () {
            pid = $(this).attr("pid")
            tr = $(this).parents('tr')
            swal({
                    title: "确定要删除吗?",
                    text: "删除将不可恢复!",
                    type: "warning",
                    showCancelButton: true,
                    confirmButtonClass: "btn-danger",
                    confirmButtonText: "删了吧!",
                    cancelButtonText: "不删了",
                    closeOnConfirm: false,
                },
                function () {
                    $.ajax({
                        url: "/del_aj/" + pid + "/",
                        type: "get",
                        dataType: "json",
                        success: function (arg) {
                            if (arg.status == 1) {
                                tr.remove();
                                swal("已经删除!", "案件已经被删除，你可以跑路了！", "success");
                            } else {
                                swal("删除失败!", "您删除的案件不存在,或权限不足！", "success");
                            }

                        }
                    })
                });
        })
    </script>
{% endblock %}